package com.kaili.config;

import com.kaili.common.util.SnowflakeIdFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SnowFlakeConfig {
    @Value("${snowflake.workId}")
    Integer workId;
    @Value("${snowflake.centerId}")
    Integer centerId;
    @Bean
    SnowflakeIdFactory getSnowflake(){
        SnowflakeIdFactory snowflakeIdFactory = new SnowflakeIdFactory(workId,centerId);
        return snowflakeIdFactory;
    }
}
